<template>
  <div class="app-container">
    <el-form :model="queryParams" size="small" :inline="true">
      <el-form-item>
        <el-cascader
          placeholder="团队名称"
          :options="options"
          filterable
        ></el-cascader>
      </el-form-item>
      <el-form-item>
        <el-cascader
          placeholder="报名渠道名称"
          :options="options"
          filterable
        ></el-cascader>
      </el-form-item>
      <el-form-item>
        <el-input placeholder=""></el-input>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:role:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:role:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:role:remove']"
          >删除</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <!-- <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:role:export']"
          >导出</el-button
        > -->
        <el-dropdown size="mini" split-button type="info">
          更多设置
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item  icon="el-icon-close">批量取消</el-dropdown-item>
            <el-dropdown-item  icon="el-icon-download">导出报名选手</el-dropdown-item>
            <el-dropdown-item  icon="el-icon-download">导出参赛选手</el-dropdown-item>
            <el-dropdown-item  icon="el-icon-upload2">导入报名选手</el-dropdown-item>
            <el-dropdown-item  icon="el-icon-upload2">批量配号</el-dropdown-item>
            <el-dropdown-item  icon="el-icon-close">清空配号</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table :data="bannerList" style="width: 100%">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="Id" type="index" align="center" width="100" />
      <el-table-column prop="item" label="比赛项目" align="center" width="200">
      </el-table-column>
      <el-table-column prop="name" label="姓名" align="center" width="100"></el-table-column>
      <el-table-column prop="sex" label="性别" align="center" width="100">
      </el-table-column>
      <el-table-column prop="phone" label="手机号" align="center" width="100">
      </el-table-column>
      <el-table-column prop="cardId" label="证件号" align="center" width="100">
      </el-table-column>
      <el-table-column prop="status" label="状态" align="center" width="200">
      </el-table-column>
      <el-table-column prop="teamName" label="所属团队" align="center" width="100">
      </el-table-column>
      <el-table-column prop="playerId" label="选手号" align="center" width="100">
      </el-table-column>
      <el-table-column prop="channel" label="报名渠道" align="center" width="100">
      </el-table-column>
      <el-table-column prop="date" label="报名日期" align="center" width="200">
      </el-table-column>
      <el-table-column fixed="right" label="操作" align="center" width="200">
        <template slot-scope="scope">
          <el-button
            type="text"
            @click="handleUpdate(scope.row)"
            icon="el-icon-edit"
            size="mini"
            >修改</el-button
          >
          <el-button
            type="text"
            icon="el-icon-document"
            size="mini"
            @click="handleAttachment(scope.row)"
            >附件</el-button
          >
          <el-button
            type="text"
            icon="el-icon-delete"
            size="mini"
            @click="handleLookStatus(scope.row)"
            >报名状态</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="tableData"
    />

    <!-- 添加或修改角色配置对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="500px"
      append-to-body
      @close="reset"
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="标题" prop="eventName">
          <el-input v-model="form.title" placeholder="请输入标题" />
        </el-form-item>
        <el-form-item label="图片" prop="image">
          <!-- 放置上传图片 -->
          <image-upload :limit="1" v-model="form.image"></image-upload>
        </el-form-item>
        <el-form-item label="跳转链接" prop="url">
          <el-input v-model="form.url" placeholder="请输入跳转链接" />
        </el-form-item>
        <el-form-item label="状态">
          <el-radio-group v-model="form.status">
            <el-radio
              v-for="dict in dict.type.sys_normal_disable"
              :key="dict.value"
              :label="dict.value"
              >{{ dict.label }}</el-radio
            >
          </el-radio-group>
        </el-form-item>
        <el-form-item label="权重" prop="weight">
          <el-input v-model.number="form.weight" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  dicts: ["sys_normal_disable", "sys_user_sex"],
  methods: {
    handleAdd() {
      this.open = true;
      this.title = "新增选手";
    },
    handleUpdate(row) {
      this.open = true;
      this.title = "编辑选手";
    },
    deleteRow(index, rows) {
      rows.splice(index, 1);
    },
    reset() {
      this.form = {};
    },
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 是否显示弹出层
      open: false,
      // 弹出层标题
      title: "",
      // 表单参数
      form: {},
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        title: undefined,
        url: undefined,
        status: undefined,
        createTime: "",
      },
      personalList: [
        {
          date: "2023-06-03 08:30:00",
          title: "2023超级飞侠亲子乐运会欢乐赛深圳站",
          image:
            "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        },
        {
          date: "2023-04-16 08:00:00",
          title: "2023杭州湘湖半程马拉松",
          image:
            "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        },
        {
          date: "2023-06-03 08:30:00",
          title: "2023超级飞侠亲子乐运会欢乐赛深圳站",
          image:
            "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        },
        {
          date: "2023-04-16 07:30:00",
          title: "中国银行2023武汉马拉松",
          image:
            "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        },
        {
          date: "2023-06-03 08:30:00",
          title: "2023超级飞侠亲子乐运会欢乐赛深圳站",
          image:
            "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        },
        {
          date: "2023-06-03 08:30:00",
          title: "2023超级飞侠亲子乐运会欢乐赛深圳站",
          image:
            "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        },
        {
          date: "2023-06-03 08:30:00",
          title: "2023超级飞侠亲子乐运会欢乐赛深圳站",
          image:
            "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
        },
      ],
      total: 50,
      // 表单校验
      rules: {},
    };
  },
};
</script>
